import os

pid = os.fork()
if pid < 0:
    print('Error')
elif pid == 0:
    print('Child process', os.getpid())
    os._exit(2)
else:
    # 等待处理僵尸进程
    # pid, status = os.wait()
    pid, status = os.waitpid(-1, os.WNOHANG)
    print('pid:', pid)
    print('status:', os.WEXITSTATUS(status))
